Near field communication (near field communication, NFC for short) is a short-range wireless connection technology based on a radio frequency identification (radio frequency identification, RFID for short) technology, and implements short-distance communication between electronic devices by using magnetic field induction.
A device having an NFC function (NFC device for short) mainly includes the following three functional entities: a device host (device host, DH for short), an NFC controller (NFC controller, NFCC for short), and an NFC execution environment (NFC Execution Environment, NFCEE for short). The DH is responsible for managing the NFCC, for example, initialization, configuration, and power supply management. The NFCC is responsible for performing physical transmission of data by using a radio frequency interface and an antenna. The NFCEE may provide a secure execution environment for an NFC application program. An NFC control interface (NFC control interface, NCI for short) defines a logical interface used for communication between the DH and the NFCC. The DH and the NFCC may communicate with each other by using an NCI protocol. In addition, the NFCC and the NFCEE may communicate with each other by using a communication protocol such as a host controller interface (host controller interface, HCI for short) or the Single Wire Protocol (single wire protocol, SWP for short).
In the prior art, a DH may configure a listen mode routing table for an NFCC, where the listen mode routing table may include any one or more of an AID (Application Identifier, application identifier) based routing entry, an APDU (Application Protocol Data Unit, application protocol data unit) pattern-based routing entry, an NFCID2 (NFC device identifier) based routing entry, a protocol-based routing entry, or a technology-based routing entry. After receiving a data frame sent by a peer NFC device, the NFCC searches for a matched routing entry according to an existing routing mechanism, to find a correct target NFCEE.
According to an existing routing mechanism defined in the stable draft of the NCI 2.0 specification, to find a target NFCEE, the foregoing multiple routing manners may need to be used sequentially, and therefore it is likely to cause a relatively long route selection time and relatively low communication efficiency; furthermore, when the technology-based routing manner or even the protocol-based routing manner is used to select the target NFCEE, it is very likely that the determined target NFCEE is not correct, and therefore communication fails; in addition, when still no correct target NFCEE is found after all routing manners that can be used are used for searching, different NFCC vendors perform different processing according to different implementation manners, and therefore it is likely to cause problems such as chaotic implementation manners and complex implementation solutions.